﻿using IrrKlang;

namespace Chimp.Core
{
    public class ChimpAudio
    {
        //private static AudioContext Context = null;
        //private static XRamExtension XRam = null;
        public static ISoundEngine Engine;
        public ISoundSource Base;
        private int Buffer;

        public ChimpAudio(string path)
        {
            Base = Engine.AddSoundSourceFromFile(path);
        }

        public static void InitAudio()
        {
            //Context = new AudioContext();
            //XRam = new XRamExtension();
            Engine = new ISoundEngine();
        }

        public static void StopSounds()
        {
            Engine.StopAllSounds();
        }

        public ChimpAudioSource Play(bool loop)
        {
            var ca = new ChimpAudioSource(Base);
            ca.Sound = Engine.Play2D(Base, loop, false, false);
            return ca;
        }
    }
}